﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BUS.DAL;

namespace BUS
{
    public class LoaiSanPhamBUS
    {
        #region Properties
        public int ID { get; set; }
        public string MaLoai { get; set; }
        public string TenLoai { get; set; }
        
        //biến flag để xác định hành động
        // 1. Add   2. Update
        public int FlagAdd { get; set; } 
        
        #endregion



        public static List<LoaiSanPhamBUS> GetAll()
        {
            return LoaiSanPhamDAL.GetAll();
        }

        public static string GetNameByID(int id)
        {
            return LoaiSanPhamDAL.GetNameByID(id);
        }

        public void Add()
        {
            ID = LoaiSanPhamDAL.Insert(this);
        }

        public void Update()
        {
            LoaiSanPhamDAL.Update(this);
        }

        public void Delete()
        {
            LoaiSanPhamDAL.Delete(this);
        }

        public static LoaiSanPhamBUS GetByID(int ID)
        {
            return LoaiSanPhamDAL.GetByID(ID);
        }
    }
}
